package com.example.springsouress;

import com.example.springsouress.com.bean.HelloCat;
import com.example.springsouress.com.bean.JackDog;
import com.example.springsouress.com.bean.Tomcat;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class SpringSouressApplication {

    public static void main(String[] args) {

        //1、返ioc容器
        ConfigurableApplicationContext run = SpringApplication.run(SpringSouressApplication.class, args);


        Tomcat tomcat = run.getBean("tomcat", Tomcat.class);
        System.out.println(tomcat.getJackDog());


        JackDog jackDog = run.getBean("jackDog", JackDog.class);
        System.out.println(jackDog==tomcat.getJackDog());

        HelloCat bean = run.getBean(HelloCat.class);
        System.out.println(bean);

    }

}
